<?php
/*
# ------------------------------------------------------------------------
# JA Teline III - Version 1.3 - Licence Owner jSharing.COM
# ------------------------------------------------------------------------
# Copyright (C) Lifetime Joomla Just for Sharing, Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: Joomla Just for Sharing
# Websites:  http://jsharing.com -  http://jsharing.net
# This file may not be redistributed in whole or significant part.
# ------------------------------------------------------------------------
*/

$headlinelang 			= 	trim( $params->get( 'headlinelang' ));
$headlineheight 		= 	intval ($params->get( 'headlineheight' ));
$numberofheadlinenews 	= 	intval (trim( $params->get( 'numberofheadlinenews', 10 ) ));
$delaytime 				= 	intval (trim( $params->get( 'delaytime', 5 ) ));
$autoroll 			= 	intval (trim( $params->get( 'autoroll', 0) ));
$showhlreadmore 				= 	intval (trim( $params->get( 'showhlreadmore', 1 ) ));
$showhltitle 				= 	intval (trim( $params->get( 'showhltitle', 1 ) ));
$showhltools 				= 	intval (trim( $params->get( 'showhltools', 1 ) ));
$hiddenClasses 				= 	trim( $params->get( 'hiddenClasses', '' ) );

$imgalign = 'left';

$numberofheadlinenews = ($numberofheadlinenews < count($rows)) ? $numberofheadlinenews : count($rows);

if ($numberofheadlinenews >= 1) {
	if (isset($_COOKIE['JAHL-AUTOROLL'])) $autoroll = ($_COOKIE['JAHL-AUTOROLL']) ? 1 : 0;
	setcookie("JAHL-AUTOROLL", $autoroll, 0, "/");
	
	if (!defined ('_MODE_JAMEGAMENU_FP_ASSETS_HEADLINE')) {
		define ('_MODE_JAMEGAMENU_FP_ASSETS_HEADLINE', 1);
		JHTML::script('headline.js','modules/'.$module->module.'/assets/');
	}

	
?>
	<script type="text/javascript">
	/* <![CDATA[ *//* ]]> */
		var jaNewsHL = new JA_NewsHeadline({
				autoroll: <?php echo intval($autoroll || !$showhltools);?>,
				total: <?php echo $numberofheadlinenews;?>,
				delaytime: <?php echo $delaytime;?>
		});
		window.addEvent('domready', function() {
			jaNewsHL.start();
		});
	/* ]]> */	
	</script>

<?php
}
$pauseplay = $autoroll?'Pause':'Play';
?>

<div id="ja-newshlcache" style="display: none">
<?php
foreach ($rows as $news) {
	$link   = JRoute::_(ContentHelperRoute::getArticleRoute($news->slug, $news->catslug, $news->sectionid));
	$image = modJANewsHelperFP::replaceImage ($news, $imgalign, 1, $bigmaxchar, 1, $bigimg_w, $bigimg_h, $hiddenClasses);
?>
	<div class="ja-zincontent">
		<div class="inner clearfix">
			<?php echo $image; ?>
			<?php if ($showhltitle) { ?>
			<h4 class="ja-zintitle"><a href="<?php echo $link;?>" class="ja-newstitle" title="<?php echo strip_tags($news->title); ?>"><?php echo $news->title;?></a></h4>
			<?php } ?>
			<?php 
			if($bigmaxchar > strlen($news->introtext)) {
				echo $news->introtext;
			} else {
				echo $news->introtext1;
			}
			?>
			<?php if ($showhlreadmore) {?>
			<a href="<?php echo $link;?>" class="readon"><span><?php echo JText::_('READ MORE...');?></span></a>
			<?php } ?>
		</div>
	</div>
<?php
}
?>
</div>

<div id="ja-zinhlwrap">
<div class="ja-zinhl clearfix" style="width: 100%;<?php echo ($headlineheight ? " height: {$headlineheight}px; overflow: hidden;" : ""); ?>">

	<div class="ja-zinhlinner" style="width: 100%;">
		<?php
		if($showhltools || $headlinelang) {
		?>
		<div class="ja-zinsec clearfix">
			<h2><?php echo $headlinelang;?></h2>
		<?php
			if($showhltools) {
		?>
			<div class="ja-zinhl-controlbar">
				<ul>
					<li><img title="<?php echo $pauseplay;?>" style="cursor: pointer;" id="jahl-switcher" onclick="jaNewsHL.toogle(); return false;" src="<?php echo modJaNewsHelperFP::getFile(strtolower($pauseplay).'.png','modules/mod_janews_fp/assets/','templates/'.$mainframe->getTemplate().'/images/'); ?>" alt="<?php echo $pauseplay;?>" border="0" /></li>
					<li><img title="" style="cursor: pointer;" onclick="jaNewsHL.prev(); return false;" id="jahl-prev" src="<?php echo modJaNewsHelperFP::getFile('prev.png','modules/mod_janews_fp/assets/','templates/'.$mainframe->getTemplate().'/images/'); ?>" alt="Previous" border="0" /></li>
					<li><img title="" style="cursor: pointer;" onclick="jaNewsHL.next(); return false;" id="jahl-next" src="<?php echo modJaNewsHelperFP::getFile('next.png','modules/mod_janews_fp/assets/','templates/'.$mainframe->getTemplate().'/images/'); ?>" alt="Next" border="0" /></li>
				</ul>
				<span id="ja-zinhl-counter">1/<?php echo $numberofheadlinenews;?></span>
			</div>
		<?php } ?>
		</div>
		<?php } ?>
		<div id="ja-zinhl-newsitem"></div>
	</div>

</div></div>
